<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item style="font-size:20px">个人中心</el-breadcrumb-item>
    </el-breadcrumb>
    <el-row class="margintop20">
      <el-col :span="10">
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="用户名">
            <el-input v-model="form.username"></el-input>
          </el-form-item>
          <el-form-item label="手机号">
            <el-input v-model="form.mobile"></el-input>
          </el-form-item>
          <el-form-item label="密码">
            <el-input type="password" v-model="form.password" show-password></el-input>
          </el-form-item>
          <el-form-item label="状态：" prop="status">
            <el-select v-model="form.status" disabled="disabled">
              <el-option
                v-for="(role,i) in statusList"
                :key="i"
                :label="role.label"
                :value="role.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="角色：" prop="roleid"  >
            <el-select v-model="form.roleid" disabled="disabled">
              <el-option
                v-for="(role,i) in roleList"
                :key="i"
                :label="role.label"
                :value="role.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="success" class="width100" @click="changemine">修改</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>


<script>
import { getuserinfo ,updateusername} from "@/api";
import { roleList, statusList } from "@/utils";
export default {
  data() {
    return {
      user: [],
      form: {},
      roleList,
      statusList
    };
  },
  methods: {
    changemine(){
       
      updateusername(this.form)
      .then(res=>{
        if(res.type){
          this.$message.success('修改成功...')
          this.$router.push({name:'home'})
        }
      })
    }
  },
  mounted() {
    getuserinfo().then((res) => {
      if (res.type) {
        this.form = res.result;
      }
    });
  },
};
</script>